package com.example.web.listener;



import com.example.web.entity.Container;
import com.example.web.entity.Goods;
import com.example.web.repository.ContainerRepository;
import com.example.web.repository.GoodRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionTemplate;

import javax.persistence.*;
import java.util.List;
import java.util.Set;

@Slf4j
@Component
public class ObjectChangeListener {




    private static ContainerRepository containerRepository;;


    private static EntityManager entityManager;

    public ObjectChangeListener() {
    }

    @Autowired
    public ObjectChangeListener(ContainerRepository containerRepository,EntityManager entityManager) {
        this.containerRepository=containerRepository;
        this.entityManager = entityManager;
    }

    @PostUpdate
    public void postUpdate(Goods goods) {
      log.info("goodsId:{}",goods.getId());
    }

}
